import request from '@/config/axios'

export interface DeptVO {
  id?: number
  name: string
  parentId: number
  leaderId: string
  phone: string
  email: string
  status: number
  sort: number
  createTime?: string
  leader?: any
}

export const getDeptSimpleList = async (status?: number) => {
  return await request.get({ url: '/system/dept/simple-list', params: { status } })
}

export const getDeptList = async (params: any) => {
  return await request.get({ url: '/system/dept/list', params })
}

export const getDept = async (id: number) => {
  return await request.get({ url: '/system/dept/get', params: { id } })
}

export const createDept = async (data: DeptVO) => {
  return await request.post({ url: '/system/dept/create', data: data })
}

export const updateDept = async (data: DeptVO) => {
  return await request.post({ url: '/system/dept/update', data: data })
}

export const deleteDept = async (id: number) => {
  return await request.delete({ url: '/system/dept/delete', params: { id } })
}
